//package com.nari.ncps.screen.config.datasource;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.boot.context.properties.ConfigurationProperties;
//import org.springframework.boot.jdbc.DataSourceBuilder;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.context.annotation.Primary;
//import org.springframework.transaction.annotation.EnableTransactionManagement;
//
//import javax.sql.DataSource;
//import java.util.HashMap;
//import java.util.Map;
//
//@Configuration
//@EnableTransactionManagement
//public class DataSourceConfig {
//
//
//    @Bean
//    @ConfigurationProperties("spring.datasource.primary")
//    public DataSource primaryDataSource() {
//        return DataSourceBuilder.create().build();
//    }
//
//    @Bean
//    @ConfigurationProperties("spring.datasource.secondary")
//    public DataSource secondaryDataSource() {
//        return DataSourceBuilder.create().build();
//    }
//
//    @Bean
//    @Primary
//    public DataSource dateSource(@Qualifier("primaryDataSource") DataSource primaryDataSource,
//                                 @Qualifier("secondaryDataSource") DataSource secondaryDataSource) {
//        Map<Object,Object> targetDataSources = new HashMap<>();
//        targetDataSources.put("primary", primaryDataSource);
//        targetDataSources.put("secondary", secondaryDataSource);
//
//        DynamicDataSource dynamicDataSource = new DynamicDataSource();
//        dynamicDataSource.setTargetDataSources(targetDataSources);
//        dynamicDataSource.setDefaultTargetDataSource(primaryDataSource);
//
//        return dynamicDataSource;
//    }
//
//
//}
